package engine.physics;

import engine.entities.Entity;
import engine.entities.Spatial;

public class Gravity implements PhysicsResolver {

	@Override
	public void updatePhysics(Entity e, float delta) {
		Spatial spatial = e.getSpatial();
		float y = spatial.getY();
		if (y < 0) {
			spatial.setSpeedY(0);
			spatial.setY(0);
		} else {
			spatial.addSpeedY(-9.81f*e.getPhysical().getMass()*delta);
		}
	}

}
